package com.foucus.myfouces.MVP.View.views.Activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;

import com.foucus.myfouces.Base.BaseActivity;
import com.foucus.myfouces.R;

/**
 * Created by yf-06 on 2017/6/27.
 */

public class SplashActivity extends BaseActivity {
    private Activity mActivity;
    private Handler handler = new Handler();


    class MyRunable implements Runnable {
        @Override
        public void run() {
            pushActivity();
        }
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        mActivity = this;
        init();
    }

    private void init() {
        handler.postDelayed(new MyRunable(), 2000);
    }

    private void pushActivity() {
        Intent intent = new Intent(mActivity, MainActivity.class);
        startActivity(intent);
        finish();
        overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
    }
}
